import Core from "../Core";
import { getNowMillisecond } from "../utils/TimeUtils";
import ModelBase, { save } from "./ModelBase";

export default class HeroModel extends ModelBase {
  @save //最后保存时间
  public lastSaveTime: number = NaN;
  @save //最近登录时间
  public lastLoginTime: number = NaN;
  @save //连续登录天数
  public loginDays: number = NaN;
  @save //当前等级
  public level: number = NaN;
  @save //当前经验
  public exp: number = NaN;
  @save //当前金币
  public coin: number = NaN;
  @save //当前钻石
  public diamond: number = NaN;
  @save //当前技能点
  public skillPoint: number = NaN;
  @save //当前在线时长
  public todayOnlineTime: number = NaN;

  init() {
    console.info("----初始化角色数据----");
    this.level = 1;
    this.exp = 0;
    this.coin = 0;
    this.diamond = 0;
    this.skillPoint = 0;
    this.loginDays = 1;
    this.lastLoginTime = getNowMillisecond();
    this.lastLoginTime = getNowMillisecond();
    this.todayOnlineTime = 0; //单位秒
  }
}
